PROJECT(dc1394cam_driver)

cmake_minimum_required(VERSION 2.6)

ADD_LIBRARY(dc1394cam_driver SHARED dc1394cam_driver.cpp dc1394cam_driver_multi.cpp)

# create symbolic lib target for calling target lib_XXX
ADD_CUSTOM_TARGET( lib DEPENDS lib_${PROJECT_NAME} )

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_common/")

FIND_PACKAGE(Dc1394 REQUIRED)
FIND_PACKAGE(OpenCV)
FIND_PACKAGE(Vxl)

IF(VXL_FOUND)
    SET( DC1394CAM_DRIVER_VXL_INSTALLED 1)
    TARGET_LINK_LIBRARIES(dc1394cam_driver vil)
ENDIF(VXL_FOUND)


IF(OPENCV_FOUND)
    SET( DC1394CAM_DRIVER_OPENCV_INSTALLED 1)
ENDIF(OPENCV_FOUND)

CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})

TARGET_LINK_LIBRARIES(dc1394cam_driver dc1394)

INSTALL( TARGETS dc1394cam_driver DESTINATION lib PERMISSIONS
    OWNER_READ OWNER_WRITE OWNER_EXECUTE
    GROUP_READ GROUP_EXECUTE
    WORLD_READ WORLD_EXECUTE )

INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h dc1394cam_driver.h DESTINATION include/dc1394cam_driver)

